<template>
	<view class="mingxi">
		<view class="list" v-for="(item, index) in list" :key="index">
			

			<view class="left">
				<view class="from">
					<text>{{ item.source | getType }}</text>
				</view>
				<view class="time">
					{{ item.addtime }}
				</view>
			</view>
			<view class="right">
				<view class="money" :class="{'add': item.type == 1, 'plus': item.type == 2}">
					{{item.type == 1 ? "+":"-"}}{{ item.amount }}
				</view>
				<!-- <view class="orderid">
					{{ item.orderid }}
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
			}
		},
		computed: {
			token() {
				return this.$store.state.token; 
			}
		},
		filters: {
			getType( val ) {
				let str = ""
				if(val == 1) {
					return "订单收入"
				} else if (val == 2) {
					return "创客收入"
				} else {
					return "提现收入"
				}
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			// 获取零钱明细
			async getList() {
				let res = await this.$Request("POST","/mydata/premium", { token: this.token })
				console.log(res);
				if(res.data.code == 202) {
					this.list = res.data.data
				}
			}
		},
	}
</script>

<style scoped lang="scss">
	.mingxi {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		.list {
			width: 100%;
			box-sizing: border-box;
			justify-content: space-between;
			display: flex;
			align-items: center;
			font-size: 24rpx;
			padding: 20rpx 0;
			border-bottom: 1px solid #f2f2f2;
			.left {
				.from {
					font-size: 40rpx;
					font-weight: bold;
				}
			}
		}
	}
	.add {
		color: blue;
	}
	.plus {
		color: red;
	}
</style>
